// AUSlotsSpinTestClientData.H : Declaration of the CAUSlotsSpinTestClientData class

#ifndef __AUSLOTSSPINTESTCLIENTDATA_H_
#define __AUSLOTSSPINTESTCLIENTDATA_H_

class CAUSlotsSpinTestNumClientDataSetsAccessor
{
public:
	LONG m_gutsid;
	LONG m_NumDataSets;

BEGIN_COLUMN_MAP(CAUSlotsSpinTestNumClientDataSetsAccessor)
	COLUMN_ENTRY(1, m_NumDataSets)
END_COLUMN_MAP()

BEGIN_PARAM_MAP(CAUSlotsSpinTestNumClientDataSetsAccessor)
	COLUMN_ENTRY(1, m_gutsid)
END_PARAM_MAP()

DEFINE_COMMAND_EX(CAUSlotsSpinTestNumClientDataSetsAccessor, L" \
	SELECT \
		count(dataset) AS NumDataSets \
	FROM dbo.AUSlotsSpinTestClientData \
	WHERE gutsid = ? ")

	// You may wish to call this function if you are inserting a record and wish to
	// initialize all the fields, if you are not going to explicitly set all of them.
	void ClearRecord()
	{
		memset(this, 0, sizeof(*this));
	}
};

class CAUSlotsSpinTestNumClientDataSets : public CCommand<CAccessor<CAUSlotsSpinTestNumClientDataSetsAccessor> >
{
public:
	HRESULT Open( CSession* pSession )
	{
		return CCommand<CAccessor<CAUSlotsSpinTestNumClientDataSetsAccessor> >::Open(*pSession);
	}
};

class CAUSlotsSpinTestClientDataSetsAccessor
{
public:
	LONG m_gutsid;
	LONG m_dataset;
	BYTE m_bonusgametype;

BEGIN_COLUMN_MAP(CAUSlotsSpinTestClientDataSetsAccessor)
	COLUMN_ENTRY(1, m_dataset)
	COLUMN_ENTRY(2, m_bonusgametype)
END_COLUMN_MAP()

BEGIN_PARAM_MAP(CAUSlotsSpinTestClientDataSetsAccessor)
	COLUMN_ENTRY(1, m_gutsid)
END_PARAM_MAP()

DEFINE_COMMAND_EX(CAUSlotsSpinTestClientDataSetsAccessor, L" \
	SELECT \
		dataset, \
		bonusgametype \
		FROM dbo.AUSlotsSpinTestClientData \
		WHERE gutsid = ? \
		GROUP BY \
			dataset, \
			bonusgametype")

	// You may wish to call this function if you are inserting a record and wish to
	// initialize all the fields, if you are not going to explicitly set all of them.
	void ClearRecord()
	{
		memset(this, 0, sizeof(*this));
	}
};

class CAUSlotsSpinTestClientDataSets : public CCommand<CAccessor<CAUSlotsSpinTestClientDataSetsAccessor> >
{
public:
	HRESULT Open( CSession* pSession )
	{
		return CCommand<CAccessor<CAUSlotsSpinTestClientDataSetsAccessor> >::Open(*pSession);
	}
};

class CAUSlotsSpinTestClientDataAccessor
{
public:
	LONG m_gutsid;
	LONG m_dataset;
	BYTE m_bonusgametype;
	LONG m_datavalue;

BEGIN_COLUMN_MAP(CAUSlotsSpinTestClientDataAccessor)
	COLUMN_ENTRY(1, m_datavalue)
END_COLUMN_MAP()

BEGIN_PARAM_MAP(CAUSlotsSpinTestClientDataAccessor)
	COLUMN_ENTRY(1, m_gutsid)
	COLUMN_ENTRY(2, m_dataset)
	COLUMN_ENTRY(3, m_bonusgametype)
END_PARAM_MAP()

DEFINE_COMMAND_EX(CAUSlotsSpinTestClientDataAccessor, L" \
	SELECT \
		datavalue \
	FROM dbo.AUSlotsSpinTestClientData \
	WHERE \
		gutsid = ? AND \
		dataset = ? AND \
		bonusgametype = ? \
	ORDER BY \
		datasetindex")

	// You may wish to call this function if you are inserting a record and wish to
	// initialize all the fields, if you are not going to explicitly set all of them.
	void ClearRecord()
	{
		memset(this, 0, sizeof(*this));
	}
};

class CAUSlotsSpinTestClientData : public CCommand<CAccessor<CAUSlotsSpinTestClientDataAccessor> >
{
public:
	HRESULT Open( CSession* pSession )
	{
		return CCommand<CAccessor<CAUSlotsSpinTestClientDataAccessor> >::Open(*pSession);
	}
};

#endif // __AUSLOTSSPINTESTCLIENTDATA_H_
